package com.lianxi

import scala.collection.mutable.ArrayBuffer

/**
  * Created by adengdeng on 2017/8/6 
  */
object Lx4 {

  def main(args: Array[String]): Unit = {

    val a = Array(0, 1, -2, 3, -4, 5)

    val buffer = new ArrayBuffer[Int]()

    buffer ++= (for(i <- a if i > 0) yield i)
    buffer ++= (for(i <- a if i <= 0) yield i)

    println(buffer.mkString(" "))
  }
}
